﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
			 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
			 xmlns:mvvmLightCommand="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
			 xmlns:behaviors="clr-namespace:Rio.Manager.Application.Behaviors"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
			 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
			 x:Class="Rio.Manager.Application.Views.GroupSynchronizationTabView"
			 mc:Ignorable="d"
			 d:DesignHeight="768"
			 d:DesignWidth="1024">

	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="/Rio.Manager.Application;component/Skins/GroupSynchronizationTabSkin.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
		<Style x:Key="BorderStyleGroupCorrespondence" TargetType="Border">
			<Setter Property="Effect">
				<Setter.Value>
					<DropShadowEffect BlurRadius="10"/>
				</Setter.Value>
			</Setter>
			<Setter Property="Background" Value="#4CF9F9F9"/>
		</Style>
	</UserControl.Resources>

	<UserControl.DataContext>
		<Binding Path="GroupSynchronizationTab"
				 Source="{StaticResource Locator}" />
	</UserControl.DataContext>

	<Grid x:Name="LayoutRoot">
		
		<i:Interaction.Triggers>
			<i:EventTrigger EventName="Loaded">
				<mvvmLightCommand:EventToCommand Command="{Binding InitializationCommand}" />
			</i:EventTrigger>
		</i:Interaction.Triggers>

		<!--Border.-->
		<Border HorizontalAlignment="Center" 
				Padding="15,15,15,15" 
				Margin="230,0,230,0"
				VerticalAlignment="Center"  
				BorderBrush="Black" Style="{StaticResource BorderStyleGroupCorrespondence}" 
				Background="#FFF9F9F9">

			<Grid>
				<!--General grid definition.-->
				<Grid.RowDefinitions>
					<RowDefinition/>
					<RowDefinition/>
					<RowDefinition/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>

				<!--View Group Correspondence synchronization between RIO and AD.-->

				<!--View title.-->
				<TextBlock Grid.Row="0"
						   TextWrapping="Wrap"
						   Text="{Binding LblRioAndAdAssociationExplanation}"
						   FontWeight="Bold"
						   HorizontalAlignment="Left"
						   Margin="0,10,0,20"/>

				<!--Ad configuration part.-->
				<StackPanel Orientation="Horizontal"
							HorizontalAlignment="Center" 
							Grid.Row="1"
							d:LayoutOverrides="Height"
							Margin="20,20,20,20">
					
					<!--Ad configuration choice.-->
					<TextBlock TextWrapping="Wrap"
							   Text="{Binding LblConfiAd}"
							   FontWeight="Bold"/>

					<ComboBox x:Name="Cbb_ADConfig"	
							  Margin="10,0,0,0"
							  Width="220"
							  ItemsSource="{Binding AdConfigCustomer, Mode=TwoWay}"
							  DisplayMemberPath="AdName"                              
							  SelectedValue="{Binding SelectedAdConfigCustomer, Mode=TwoWay}"/>                              

				</StackPanel>

				<!--Correspondence between RIO and AD.-->
				<StackPanel Orientation="Vertical"
							Grid.Row="2"
							d:LayoutOverrides="Height"
							Margin="20,20,20,20">
					
					<!--Grid Informations.-->                    
					<Grid>

						<!--Row grid definition.-->
						<Grid.RowDefinitions>
							<RowDefinition/>
							<RowDefinition Height="20"/>
							<RowDefinition/>
						</Grid.RowDefinitions>

						<!--Column grid definition.-->
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="60"/>
							<ColumnDefinition Width="220"/>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="60"/>
							<ColumnDefinition Width="220"/>
						</Grid.ColumnDefinitions>
						
						<!--Fist line: Last and First Name.-->
						
						<!--Last name.-->
						<TextBlock Grid.Row="0"
								   Grid.Column="0"
								   TextWrapping="Wrap"
								   Text="{Binding LblLastName}"
								   FontWeight="Bold"/>

						<ComboBox x:Name="Cbb_LastName"
								  Grid.Row="0"
								  Grid.Column="1"                   
								  ItemsSource="{Binding ColumnValueAD, Mode=TwoWay}"
								  SelectedValue="{Binding SelectedDisplayADColumnLastName, Mode=TwoWay}"
								  SelectionChanged="Cbb_LastName_SelectionChanged"
								  IsEnabled="{Binding EnabledColumnAdAndBtnSave, Mode=TwoWay}"/>
						
						<!--First Name.-->
						<TextBlock Grid.Row="0"
								   Grid.Column="3"
								   TextWrapping="Wrap"
								   Text="{Binding LblFirstName}"
								   FontWeight="Bold"/>

						<ComboBox x:Name="Cbb_FirstName"
								  Grid.Row="0"
								  Grid.Column="4"                   
								  ItemsSource="{Binding ColumnValueAD, Mode=TwoWay}"
								  SelectedValue="{Binding SelectedDisplayADColumnFirstName, Mode=TwoWay}"
								  SelectionChanged="Cbb_FirstName_SelectionChanged"
								  IsEnabled="{Binding EnabledColumnAdAndBtnSave, Mode=TwoWay}"/>

						<!--Seconde line: Login and Mail.-->

						<!--Login.-->
						<TextBlock Grid.Row="2"
								   Grid.Column="0"
								   TextWrapping="Wrap"
								   Text="{Binding LblLogin}"
								   FontWeight="Bold"/>

						<ComboBox x:Name="Cbb_Login"
								  Grid.Row="2"
								  Grid.Column="1"                   
								  ItemsSource="{Binding ColumnValueAD, Mode=TwoWay}"
								  SelectedValue="{Binding SelectedDisplayADColumnLogin, Mode=TwoWay}"
								  SelectionChanged="Cbb_Login_SelectionChanged"
								  IsEnabled="{Binding EnabledColumnAdAndBtnSave, Mode=TwoWay}"/>

						<!--Mail.-->
						<TextBlock Grid.Row="2"
								   Grid.Column="3"
								   TextWrapping="Wrap"
								   Text="{Binding LblMail}"
								   FontWeight="Bold"/>

						<ComboBox x:Name="Cbb_Mail"
								  Grid.Row="2"
								  Grid.Column="4"                   
								  ItemsSource="{Binding ColumnValueAD, Mode=TwoWay}"
								  SelectedValue="{Binding SelectedDisplayADColumnMail, Mode=TwoWay}"
								  SelectionChanged="Cbb_Mail_SelectionChanged"
								  IsEnabled="{Binding EnabledColumnAdAndBtnSave, Mode=TwoWay}"/>
						
					</Grid>
					
				</StackPanel>

				<!--Button part.-->
				<StackPanel Orientation="Horizontal"
							Grid.Row="3"
							d:LayoutOverrides="Height"
							Margin="0,0,0,0"
							HorizontalAlignment="Right">

					<!--Save Rio and AD correspondence button-->
					<Button x:Name="Button_Save"
							Content="{Binding GroupSynchronizationTab.BtnSave, Source={StaticResource Locator},Mode=OneWay}"   
							Margin="0,10,10,10"
							Command="{Binding SaveCorrespondenceRioAdCommand}"
							IsEnabled="{Binding EnabledColumnAdAndBtnSave, Mode=TwoWay}"/>

					<!--Close Rio and AD correspondence button-->
					<Button x:Name="Button_Close"
							Content="{Binding GroupSynchronizationTab.BtnClose, Source={StaticResource Locator},Mode=OneWay}"
							Margin="0,10,20,10"
							Command="{Binding CloseCorrespondenceRioAdCommand}"/>
				</StackPanel>

				<telerik:RadBusyIndicator BusyContent=""
								  IsBusy="{Binding BusyIndicator.IsBusy, Mode=OneWay}"
								  Grid.RowSpan="2"
								  d:IsHidden="True"/>

			</Grid>
			
		</Border>
		
	</Grid>	
	
</UserControl>
